# import pandas as pd
# import matplotlib.pyplot as plt
# import seaborn as sns
# df = pd.read_excel('某公司产品销售数据.xlsx')
# plt.figure(figsize=(8, 4))
# sns.set_style(style='ticks', rc={'font.sans-serif':'SimHei'})
# sns.set_palette(sns.color_palette('husl',8))
# sns.barplot(x='销售额（万元）', y='季度', hue='地区', data=df,orient='ha')
# ax = plt.gca()
# for p in ax.containers:
#     ax.bar_label(container=p, label_type='edge')
# plt.title('某公司各季度不同地区产品销售额簇状条形图')
# plt.show()
# from pyecharts import options as opts
# from pyecharts.charts import Radar
# from pyecharts.globals import ThemeType
# radar = Radar(init_opts=opts.InitOpts(width='600px', height='400px',theme=ThemeType.ESSOS, page_title='雷达图'))
# radar.add(series_name='某员工', data=[[90, 60, 75, 85, 95]],linestyle_opts=opts.LineStyleOpts(color='red'))
# radar.add_schema(
# schema=[
# opts.RadarIndicatorItem(name='管理能力', max_=100),
# opts.RadarIndicatorItem(name='业务能力', max_=100),
# opts.RadarIndicatorItem(name='组织能力',max_=100),
# opts.RadarIndicatorItem(name='沟通能力', max_=100),
# opts.RadarIndicatorItem(name='表达能力', max_=100),
# ],
# center=['50%', '60%'],
# splitline_opt=opts.SplitLineOpts(is_show=True,linestyle_opts=opts.LineStyleOpts(color='grey')),
# textstyle_opts=opts.TextStyleOpts(color='black'),
# )
# radar.set_global_opts(
# title_opts=opts.TitleOpts(
# title='某员工能力分析雷达图', pos_left='center'),
# legend_opts=opts.LegendOpts(pos_right='35', pos_top='25'))
# radar.render('例3-5.html')
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_excel('某餐厅顾客消费记录.xlsx')
plt.figure(figsize=(8, 4))
sns.set_style(style='darkgrid', rc={'font.sans-serif': 'SimHei'})
sns.set_palette('colorblind')
sns.histplot(
    x='消费金额（元）',
    hue='顾客类型',
    data=df,
    bins=15,
    multiple='stack'
)
plt.title('某餐厅不同消费金额区间消费次数直方图')
plt.ylabel('消费次数')
plt.show()